package com.example.pc.videodemo.ThreadPool


class ThreadPool private constructor() : IThread {
    public override fun execute(runnable: Runnable?) {
        if (mNormalPool == null) {
            synchronized(ThreadPoolProxy::class.java, {
                if (mNormalPool == null) {
                    mNormalPool = ThreadPoolProxy(5, 15, 2000)
                    mNormalPool?.execute(runnable)
                }
            })
        } else {
            mNormalPool?.execute(runnable)
        }
    }

    companion object {
        private var mNormalPool: ThreadPoolProxy? = null
        private var _intance: ThreadPool? = null
        val instance: ThreadPool?
            get() {
                if (_intance == null) {
                    synchronized(ThreadPool::class.java, { _intance = ThreadPool() })
                }
                return _intance
            }
    }
}